<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-2"></span><span class="hs-comment">--</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- Pretty-printing TyThings</span><span>
</span><span id="line-4"></span><span class="hs-comment">--</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- (c) The GHC Team 2005</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-8"></span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-10"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Core.Ppr.TyThing</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-11"></span><span>        </span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprTyThing"><span class="hs-identifier">pprTyThing</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-12"></span><span>        </span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprTyThingInContext"><span class="hs-identifier">pprTyThingInContext</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-13"></span><span>        </span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprTyThingLoc"><span class="hs-identifier">pprTyThingLoc</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-14"></span><span>        </span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprTyThingInContextLoc"><span class="hs-identifier">pprTyThingInContextLoc</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-15"></span><span>        </span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprTyThingHdr"><span class="hs-identifier">pprTyThingHdr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-16"></span><span>        </span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprTypeForUser"><span class="hs-identifier">pprTypeForUser</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>        </span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprFamInst"><span class="hs-identifier">pprFamInst</span></a></span><span>
</span><span id="line-18"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-23"></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier">Type</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#ArgFlag"><span class="hs-identifier">ArgFlag</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyThing"><span class="hs-identifier">TyThing</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#mkTyVarBinders"><span class="hs-identifier">mkTyVarBinders</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Tidy.html#tidyOpenType"><span class="hs-identifier">tidyOpenType</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Iface.Syntax.html"><span class="hs-identifier">GHC.Iface.Syntax</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Iface.Syntax.html#ShowSub"><span class="hs-identifier">ShowSub</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Iface.Syntax.html#ShowHowMuch"><span class="hs-identifier">ShowHowMuch</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Iface.Syntax.html#AltPpr"><span class="hs-identifier">AltPpr</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-26"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Iface.Syntax.html#showToHeader"><span class="hs-identifier">showToHeader</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Iface.Syntax.html#pprIfaceDecl"><span class="hs-identifier">pprIfaceDecl</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html"><span class="hs-identifier">GHC.Core.Coercion.Axiom</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#coAxiomTyCon"><span class="hs-identifier">coAxiomTyCon</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html"><span class="hs-identifier">GHC.Driver.Types</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#tyThingParent_maybe"><span class="hs-identifier">tyThingParent_maybe</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Iface.Make.html"><span class="hs-identifier">GHC.Iface.Make</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Iface.Make.html#tyThingToIfaceDecl"><span class="hs-identifier">tyThingToIfaceDecl</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html"><span class="hs-identifier">GHC.Core.FamInstEnv</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInst"><span class="hs-identifier">FamInst</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamFlavor"><span class="hs-identifier">FamFlavor</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html"><span class="hs-identifier">GHC.Core.TyCo.Ppr</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprUserForAll"><span class="hs-identifier">pprUserForAll</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprTypeApp"><span class="hs-identifier">pprTypeApp</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprSigmaType"><span class="hs-identifier">pprSigmaType</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html"><span class="hs-identifier">GHC.Types.Var.Env</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#emptyTidyEnv"><span class="hs-identifier">emptyTidyEnv</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-37"></span><span class="hs-comment">-- Pretty-printing entities that we get from the GHC API</span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span><span class="hs-comment">{- Note [Pretty printing via Iface syntax]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Our general plan for pretty-printing
  - Types
  - TyCons
  - Classes
  - Pattern synonyms
  ...etc...

is to convert them to Iface syntax, and pretty-print that. For example
  - pprType converts a Type to an IfaceType, and pretty prints that.
  - pprTyThing converts the TyThing to an IfaceDecl,
    and pretty prints that.

So Iface syntax plays a dual role:
  - it's the internal version of an interface files
  - it's used for pretty-printing

Why do this?

* A significant reason is that we need to be able
  to pretty-print Iface syntax (to display Foo.hi), and it was a
  pain to duplicate masses of pretty-printing goop, esp for
  Type and IfaceType.

* When pretty-printing (a type, say), we want to tidy (with
  tidyType) to avoids having (forall a a. blah) where the two
  a's have different uniques.

  Alas, for type constructors, TyCon, tidying does not work well,
  because a TyCon includes DataCons which include Types, which mention
  TyCons. And tidying can't tidy a mutually recursive data structure
  graph, only trees.

* Interface files contains fast-strings, not uniques, so the very same
  tidying must take place when we convert to IfaceDecl. E.g.
  GHC.Iface.Make.tyThingToIfaceDecl which converts a TyThing (i.e. TyCon,
  Class etc) to an IfaceDecl.

  Bottom line: IfaceDecls are already 'tidy', so it's straightforward
  to print them.

* An alternative I once explored was to ensure that TyCons get type
  variables with distinct print-names. That's ok for type variables
  but less easy for kind variables. Processing data type declarations
  is already so complicated that I don't think it's sensible to add
  the extra requirement that it generates only &quot;pretty&quot; types and
  kinds.

Consequences:

- Iface syntax (and IfaceType) must contain enough information to
  print nicely.  Hence, for example, the IfaceAppArgs type, which
  allows us to suppress invisible kind arguments in types
  (see Note [Suppressing invisible arguments] in GHC.Iface.Type)

- In a few places we have info that is used only for pretty-printing,
  and is totally ignored when turning Iface syntax back into Core
  (in GHC.IfaceToCore). For example, IfaceClosedSynFamilyTyCon
  stores a [IfaceAxBranch] that is used only for pretty-printing.

- See Note [Free tyvars in IfaceType] in GHC.Iface.Type

See #7730, #8776 for details   -}</span><span>
</span><span id="line-103"></span><span>
</span><span id="line-104"></span><span class="hs-comment">--------------------</span><span>
</span><span id="line-105"></span><span class="hs-comment">-- | Pretty-prints a 'FamInst' (type/data family instance) with its defining location.</span><span>
</span><span id="line-106"></span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprFamInst"><span class="hs-identifier hs-type">pprFamInst</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInst"><span class="hs-identifier hs-type">FamInst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-107"></span><span class="hs-comment">--  * For data instances we go via pprTyThing of the representational TyCon,</span><span>
</span><span id="line-108"></span><span class="hs-comment">--    because there is already much cleverness associated with printing</span><span>
</span><span id="line-109"></span><span class="hs-comment">--    data type declarations that I don't want to duplicate</span><span>
</span><span id="line-110"></span><span class="hs-comment">--  * For type instances we print directly here; there is no TyCon</span><span>
</span><span id="line-111"></span><span class="hs-comment">--    to give to pprTyThing</span><span>
</span><span id="line-112"></span><span class="hs-comment">--</span><span>
</span><span id="line-113"></span><span class="hs-comment">-- FamInstEnv.pprFamInst does a more quick-and-dirty job for internal purposes</span><span>
</span><span id="line-114"></span><span>
</span><span id="line-115"></span><span id="pprFamInst"><span class="annot"><span class="annottext">pprFamInst :: FamInst -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#pprFamInst"><span class="hs-identifier hs-var hs-var">pprFamInst</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInst"><span class="hs-identifier hs-type">FamInst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">fi_flavor :: FamInst -&gt; FamFlavor
</span><a href="GHC.Core.FamInstEnv.html#fi_flavor"><span class="hs-identifier hs-var">fi_flavor</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#DataFamilyInst"><span class="hs-identifier hs-type">DataFamilyInst</span></a></span><span> </span><span id="local-6989586621681178519"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681178519"><span class="hs-identifier hs-var">rep_tc</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-116"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyThing -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#pprTyThingInContextLoc"><span class="hs-identifier hs-var">pprTyThingInContextLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; TyThing
</span><a href="GHC.Core.TyCo.Rep.html#ATyCon"><span class="hs-identifier hs-var">ATyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681178519"><span class="hs-identifier hs-var">rep_tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-117"></span><span>
</span><span id="line-118"></span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprFamInst"><span class="hs-identifier hs-var">pprFamInst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInst"><span class="hs-identifier hs-type">FamInst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">fi_flavor :: FamInst -&gt; FamFlavor
</span><a href="GHC.Core.FamInstEnv.html#fi_flavor"><span class="hs-identifier hs-var">fi_flavor</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FamFlavor
</span><a href="GHC.Core.FamInstEnv.html#SynFamilyInst"><span class="hs-identifier hs-var">SynFamilyInst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fi_axiom :: FamInst -&gt; CoAxiom Unbranched
</span><a href="GHC.Core.FamInstEnv.html#fi_axiom"><span class="hs-identifier hs-var">fi_axiom</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681178515"><span class="annot"><span class="annottext">CoAxiom Unbranched
</span><a href="#local-6989586621681178515"><span class="hs-identifier hs-var">axiom</span></a></span></span><span>
</span><span id="line-119"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fi_tvs :: FamInst -&gt; [TyVar]
</span><a href="GHC.Core.FamInstEnv.html#fi_tvs"><span class="hs-identifier hs-var">fi_tvs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681178513"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681178513"><span class="hs-identifier hs-var">tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fi_tys :: FamInst -&gt; [Type]
</span><a href="GHC.Core.FamInstEnv.html#fi_tys"><span class="hs-identifier hs-var">fi_tys</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681178511"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681178511"><span class="hs-identifier hs-var">lhs_tys</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fi_rhs :: FamInst -&gt; Type
</span><a href="GHC.Core.FamInstEnv.html#fi_rhs"><span class="hs-identifier hs-var">fi_rhs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681178509"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681178509"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-120"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#showWithLoc"><span class="hs-identifier hs-var">showWithLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SDoc
</span><a href="GHC.Types.Name.html#pprDefinedAt"><span class="hs-identifier hs-var">pprDefinedAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoAxiom Unbranched -&gt; Name
forall a. NamedThing a =&gt; a -&gt; Name
</span><a href="GHC.Types.Name.html#getName"><span class="hs-identifier hs-var">getName</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Unbranched
</span><a href="#local-6989586621681178515"><span class="hs-identifier hs-var">axiom</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; SDoc) -&gt; SDoc -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-121"></span><span>    </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;type instance&quot;</span></span><span>
</span><span id="line-122"></span><span>            </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCoVarBinder] -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprUserForAll"><span class="hs-identifier hs-var">pprUserForAll</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgFlag -&gt; [TyVar] -&gt; [TyCoVarBinder]
forall vis. vis -&gt; [TyVar] -&gt; [VarBndr TyVar vis]
</span><a href="GHC.Types.Var.html#mkTyVarBinders"><span class="hs-identifier hs-var">mkTyVarBinders</span></a></span><span> </span><span class="annot"><span class="annottext">ArgFlag
</span><a href="GHC.Types.Var.html#Specified"><span class="hs-identifier hs-var">Specified</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681178513"><span class="hs-identifier hs-var">tvs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-123"></span><span>                </span><span class="hs-comment">-- See Note [Printing foralls in type family instances]</span><span>
</span><span id="line-124"></span><span>                </span><span class="hs-comment">-- in GHC.Iface.Type</span><span>
</span><span id="line-125"></span><span>            </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprTypeApp"><span class="hs-identifier hs-var">pprTypeApp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoAxiom Unbranched -&gt; TyCon
forall (br :: BranchFlag). CoAxiom br -&gt; TyCon
</span><a href="GHC.Core.Coercion.Axiom.html#coAxiomTyCon"><span class="hs-identifier hs-var">coAxiomTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Unbranched
</span><a href="#local-6989586621681178515"><span class="hs-identifier hs-var">axiom</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681178511"><span class="hs-identifier hs-var">lhs_tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-126"></span><span>       </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#equals"><span class="hs-identifier hs-var">equals</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681178509"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span class="hs-comment">----------------------------</span><span>
</span><span id="line-129"></span><span class="hs-comment">-- | Pretty-prints a 'TyThing' with its defining location.</span><span>
</span><span id="line-130"></span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprTyThingLoc"><span class="hs-identifier hs-type">pprTyThingLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyThing"><span class="hs-identifier hs-type">TyThing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-131"></span><span id="pprTyThingLoc"><span class="annot"><span class="annottext">pprTyThingLoc :: TyThing -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#pprTyThingLoc"><span class="hs-identifier hs-var hs-var">pprTyThingLoc</span></a></span></span><span> </span><span id="local-6989586621681178499"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178499"><span class="hs-identifier hs-var">tyThing</span></a></span></span><span>
</span><span id="line-132"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#showWithLoc"><span class="hs-identifier hs-var">showWithLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SDoc
</span><a href="GHC.Types.Name.html#pprDefinedAt"><span class="hs-identifier hs-var">pprDefinedAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyThing -&gt; Name
forall a. NamedThing a =&gt; a -&gt; Name
</span><a href="GHC.Types.Name.html#getName"><span class="hs-identifier hs-var">getName</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178499"><span class="hs-identifier hs-var">tyThing</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-133"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShowSub -&gt; TyThing -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#pprTyThing"><span class="hs-identifier hs-var">pprTyThing</span></a></span><span> </span><span class="annot"><span class="annottext">ShowSub
</span><a href="GHC.Iface.Syntax.html#showToHeader"><span class="hs-identifier hs-var">showToHeader</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178499"><span class="hs-identifier hs-var">tyThing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-134"></span><span>
</span><span id="line-135"></span><span class="hs-comment">-- | Pretty-prints the 'TyThing' header. For functions and data constructors</span><span>
</span><span id="line-136"></span><span class="hs-comment">-- the function is equivalent to 'pprTyThing' but for type constructors</span><span>
</span><span id="line-137"></span><span class="hs-comment">-- and classes it prints only the header part of the declaration.</span><span>
</span><span id="line-138"></span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprTyThingHdr"><span class="hs-identifier hs-type">pprTyThingHdr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyThing"><span class="hs-identifier hs-type">TyThing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-139"></span><span id="pprTyThingHdr"><span class="annot"><span class="annottext">pprTyThingHdr :: TyThing -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#pprTyThingHdr"><span class="hs-identifier hs-var hs-var">pprTyThingHdr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShowSub -&gt; TyThing -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#pprTyThing"><span class="hs-identifier hs-var">pprTyThing</span></a></span><span> </span><span class="annot"><span class="annottext">ShowSub
</span><a href="GHC.Iface.Syntax.html#showToHeader"><span class="hs-identifier hs-var">showToHeader</span></a></span><span>
</span><span id="line-140"></span><span>
</span><span id="line-141"></span><span class="hs-comment">-- | Pretty-prints a 'TyThing' in context: that is, if the entity</span><span>
</span><span id="line-142"></span><span class="hs-comment">-- is a data constructor, record selector, or class method, then</span><span>
</span><span id="line-143"></span><span class="hs-comment">-- the entity's parent declaration is pretty-printed with irrelevant</span><span>
</span><span id="line-144"></span><span class="hs-comment">-- parts omitted.</span><span>
</span><span id="line-145"></span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprTyThingInContext"><span class="hs-identifier hs-type">pprTyThingInContext</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Iface.Syntax.html#ShowSub"><span class="hs-identifier hs-type">ShowSub</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyThing"><span class="hs-identifier hs-type">TyThing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-146"></span><span id="pprTyThingInContext"><span class="annot"><span class="annottext">pprTyThingInContext :: ShowSub -&gt; TyThing -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#pprTyThingInContext"><span class="hs-identifier hs-var hs-var">pprTyThingInContext</span></a></span></span><span> </span><span id="local-6989586621681178498"><span class="annot"><span class="annottext">ShowSub
</span><a href="#local-6989586621681178498"><span class="hs-identifier hs-var">show_sub</span></a></span></span><span> </span><span id="local-6989586621681178497"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178497"><span class="hs-identifier hs-var">thing</span></a></span></span><span>
</span><span id="line-147"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[OccName] -&gt; TyThing -&gt; SDoc
</span><a href="#local-6989586621681178496"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178497"><span class="hs-identifier hs-var">thing</span></a></span><span>
</span><span id="line-148"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-149"></span><span>    </span><span id="local-6989586621681178496"><span class="annot"><span class="annottext">go :: [OccName] -&gt; TyThing -&gt; SDoc
</span><a href="#local-6989586621681178496"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621681178494"><span class="annot"><span class="annottext">[OccName]
</span><a href="#local-6989586621681178494"><span class="hs-identifier hs-var">ss</span></a></span></span><span> </span><span id="local-6989586621681178493"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178493"><span class="hs-identifier hs-var">thing</span></a></span></span><span>
</span><span id="line-150"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TyThing -&gt; Maybe TyThing
</span><a href="GHC.Driver.Types.html#tyThingParent_maybe"><span class="hs-identifier hs-var">tyThingParent_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178493"><span class="hs-identifier hs-var">thing</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-151"></span><span>          </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681178492"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178492"><span class="hs-identifier hs-var">parent</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-152"></span><span>            </span><span class="annot"><span class="annottext">[OccName] -&gt; TyThing -&gt; SDoc
</span><a href="#local-6989586621681178496"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyThing -&gt; OccName
forall a. NamedThing a =&gt; a -&gt; OccName
</span><a href="GHC.Types.Name.html#getOccName"><span class="hs-identifier hs-var">getOccName</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178493"><span class="hs-identifier hs-var">thing</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; [OccName] -&gt; [OccName]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[OccName]
</span><a href="#local-6989586621681178494"><span class="hs-identifier hs-var">ss</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178492"><span class="hs-identifier hs-var">parent</span></a></span><span>
</span><span id="line-153"></span><span>          </span><span class="annot"><span class="annottext">Maybe TyThing
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-154"></span><span>            </span><span class="annot"><span class="annottext">ShowSub -&gt; TyThing -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#pprTyThing"><span class="hs-identifier hs-var">pprTyThing</span></a></span><span>
</span><span id="line-155"></span><span>              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShowSub
</span><a href="#local-6989586621681178498"><span class="hs-identifier hs-var">show_sub</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ss_how_much :: ShowHowMuch
</span><a href="GHC.Iface.Syntax.html#ss_how_much"><span class="hs-identifier hs-var">ss_how_much</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[OccName] -&gt; AltPpr -&gt; ShowHowMuch
</span><a href="GHC.Iface.Syntax.html#ShowSome"><span class="hs-identifier hs-var">ShowSome</span></a></span><span> </span><span class="annot"><span class="annottext">[OccName]
</span><a href="#local-6989586621681178494"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe (OccName -&gt; SDoc) -&gt; AltPpr
</span><a href="GHC.Iface.Syntax.html#AltPpr"><span class="hs-identifier hs-var">AltPpr</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (OccName -&gt; SDoc)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-156"></span><span>              </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178493"><span class="hs-identifier hs-var">thing</span></a></span><span>
</span><span id="line-157"></span><span>
</span><span id="line-158"></span><span class="hs-comment">-- | Like 'pprTyThingInContext', but adds the defining location.</span><span>
</span><span id="line-159"></span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprTyThingInContextLoc"><span class="hs-identifier hs-type">pprTyThingInContextLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyThing"><span class="hs-identifier hs-type">TyThing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-160"></span><span id="pprTyThingInContextLoc"><span class="annot"><span class="annottext">pprTyThingInContextLoc :: TyThing -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#pprTyThingInContextLoc"><span class="hs-identifier hs-var hs-var">pprTyThingInContextLoc</span></a></span></span><span> </span><span id="local-6989586621681178487"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178487"><span class="hs-identifier hs-var">tyThing</span></a></span></span><span>
</span><span id="line-161"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#showWithLoc"><span class="hs-identifier hs-var">showWithLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SDoc
</span><a href="GHC.Types.Name.html#pprDefinedAt"><span class="hs-identifier hs-var">pprDefinedAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyThing -&gt; Name
forall a. NamedThing a =&gt; a -&gt; Name
</span><a href="GHC.Types.Name.html#getName"><span class="hs-identifier hs-var">getName</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178487"><span class="hs-identifier hs-var">tyThing</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-162"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShowSub -&gt; TyThing -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#pprTyThingInContext"><span class="hs-identifier hs-var">pprTyThingInContext</span></a></span><span> </span><span class="annot"><span class="annottext">ShowSub
</span><a href="GHC.Iface.Syntax.html#showToHeader"><span class="hs-identifier hs-var">showToHeader</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178487"><span class="hs-identifier hs-var">tyThing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-163"></span><span>
</span><span id="line-164"></span><span class="hs-comment">-- | Pretty-prints a 'TyThing'.</span><span>
</span><span id="line-165"></span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprTyThing"><span class="hs-identifier hs-type">pprTyThing</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Iface.Syntax.html#ShowSub"><span class="hs-identifier hs-type">ShowSub</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyThing"><span class="hs-identifier hs-type">TyThing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-166"></span><span class="hs-comment">-- We pretty-print 'TyThing' via 'IfaceDecl'</span><span>
</span><span id="line-167"></span><span class="hs-comment">-- See Note [Pretty-printing TyThings]</span><span>
</span><span id="line-168"></span><span id="pprTyThing"><span class="annot"><span class="annottext">pprTyThing :: ShowSub -&gt; TyThing -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#pprTyThing"><span class="hs-identifier hs-var hs-var">pprTyThing</span></a></span></span><span> </span><span id="local-6989586621681178486"><span class="annot"><span class="annottext">ShowSub
</span><a href="#local-6989586621681178486"><span class="hs-identifier hs-var">ss</span></a></span></span><span> </span><span id="local-6989586621681178485"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178485"><span class="hs-identifier hs-var">ty_thing</span></a></span></span><span>
</span><span id="line-169"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(DynFlags -&gt; SDoc) -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#sdocWithDynFlags"><span class="hs-identifier hs-var">sdocWithDynFlags</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681178483"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178483"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ShowSub -&gt; IfaceDecl -&gt; SDoc
</span><a href="GHC.Iface.Syntax.html#pprIfaceDecl"><span class="hs-identifier hs-var">pprIfaceDecl</span></a></span><span> </span><span class="annot"><span class="annottext">ShowSub
</span><a href="#local-6989586621681178482"><span class="hs-identifier hs-var">ss'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; TyThing -&gt; IfaceDecl
</span><a href="GHC.Iface.Make.html#tyThingToIfaceDecl"><span class="hs-identifier hs-var">tyThingToIfaceDecl</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178483"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178485"><span class="hs-identifier hs-var">ty_thing</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-170"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-171"></span><span>    </span><span id="local-6989586621681178482"><span class="annot"><span class="annottext">ss' :: ShowSub
</span><a href="#local-6989586621681178482"><span class="hs-identifier hs-var hs-var">ss'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ShowSub -&gt; ShowHowMuch
</span><a href="GHC.Iface.Syntax.html#ss_how_much"><span class="hs-identifier hs-var hs-var">ss_how_much</span></a></span><span> </span><span class="annot"><span class="annottext">ShowSub
</span><a href="#local-6989586621681178486"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-172"></span><span>      </span><span class="annot"><a href="GHC.Iface.Syntax.html#ShowHeader"><span class="hs-identifier hs-type">ShowHeader</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Iface.Syntax.html#AltPpr"><span class="hs-identifier hs-type">AltPpr</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (OccName -&gt; SDoc)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ShowSub
</span><a href="#local-6989586621681178486"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ss_how_much :: ShowHowMuch
</span><a href="GHC.Iface.Syntax.html#ss_how_much"><span class="hs-identifier hs-var">ss_how_much</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AltPpr -&gt; ShowHowMuch
</span><a href="GHC.Iface.Syntax.html#ShowHeader"><span class="hs-identifier hs-var">ShowHeader</span></a></span><span> </span><span class="annot"><span class="annottext">AltPpr
</span><a href="#local-6989586621681178480"><span class="hs-identifier hs-var">ppr'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-173"></span><span>      </span><span class="annot"><a href="GHC.Iface.Syntax.html#ShowSome"><span class="hs-identifier hs-type">ShowSome</span></a></span><span> </span><span id="local-6989586621681178479"><span class="annot"><span class="annottext">[OccName]
</span><a href="#local-6989586621681178479"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Iface.Syntax.html#AltPpr"><span class="hs-identifier hs-type">AltPpr</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (OccName -&gt; SDoc)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ShowSub
</span><a href="#local-6989586621681178486"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ss_how_much :: ShowHowMuch
</span><a href="GHC.Iface.Syntax.html#ss_how_much"><span class="hs-identifier hs-var">ss_how_much</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[OccName] -&gt; AltPpr -&gt; ShowHowMuch
</span><a href="GHC.Iface.Syntax.html#ShowSome"><span class="hs-identifier hs-var">ShowSome</span></a></span><span> </span><span class="annot"><span class="annottext">[OccName]
</span><a href="#local-6989586621681178479"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">AltPpr
</span><a href="#local-6989586621681178480"><span class="hs-identifier hs-var">ppr'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-174"></span><span>      </span><span class="annot"><span class="annottext">ShowHowMuch
</span><span class="hs-identifier">_</span></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ShowSub
</span><a href="#local-6989586621681178486"><span class="hs-identifier hs-var">ss</span></a></span><span>
</span><span id="line-175"></span><span>
</span><span id="line-176"></span><span>    </span><span id="local-6989586621681178480"><span class="annot"><span class="annottext">ppr' :: AltPpr
</span><a href="#local-6989586621681178480"><span class="hs-identifier hs-var hs-var">ppr'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (OccName -&gt; SDoc) -&gt; AltPpr
</span><a href="GHC.Iface.Syntax.html#AltPpr"><span class="hs-identifier hs-var">AltPpr</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe (OccName -&gt; SDoc) -&gt; AltPpr)
-&gt; Maybe (OccName -&gt; SDoc) -&gt; AltPpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Maybe (OccName -&gt; SDoc)
</span><a href="#local-6989586621681178477"><span class="hs-identifier hs-var">ppr_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Maybe (OccName -&gt; SDoc))
-&gt; Name -&gt; Maybe (OccName -&gt; SDoc)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing -&gt; Name
forall a. NamedThing a =&gt; a -&gt; Name
</span><a href="GHC.Types.Name.html#getName"><span class="hs-identifier hs-var">getName</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178485"><span class="hs-identifier hs-var">ty_thing</span></a></span><span>
</span><span id="line-177"></span><span>
</span><span id="line-178"></span><span>    </span><span class="annot"><a href="#local-6989586621681178477"><span class="hs-identifier hs-type">ppr_bndr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccName"><span class="hs-identifier hs-type">OccName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-179"></span><span>    </span><span id="local-6989586621681178477"><span class="annot"><span class="annottext">ppr_bndr :: Name -&gt; Maybe (OccName -&gt; SDoc)
</span><a href="#local-6989586621681178477"><span class="hs-identifier hs-var hs-var">ppr_bndr</span></a></span></span><span> </span><span id="local-6989586621681178476"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178476"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-180"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isBuiltInSyntax"><span class="hs-identifier hs-var">isBuiltInSyntax</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178476"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-181"></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (OccName -&gt; SDoc)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-182"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-183"></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Maybe Module
</span><a href="GHC.Types.Name.html#nameModule_maybe"><span class="hs-identifier hs-var">nameModule_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178476"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-184"></span><span>             </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681178473"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681178473"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(OccName -&gt; SDoc) -&gt; Maybe (OccName -&gt; SDoc)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">((OccName -&gt; SDoc) -&gt; Maybe (OccName -&gt; SDoc))
-&gt; (OccName -&gt; SDoc) -&gt; Maybe (OccName -&gt; SDoc)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681178472"><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681178472"><span class="hs-identifier hs-var">occ</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(PprStyle -&gt; SDoc) -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#getPprStyle"><span class="hs-identifier hs-var">getPprStyle</span></a></span><span> </span><span class="annot"><span class="annottext">((PprStyle -&gt; SDoc) -&gt; SDoc) -&gt; (PprStyle -&gt; SDoc) -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681178470"><span class="annot"><span class="annottext">PprStyle
</span><a href="#local-6989586621681178470"><span class="hs-identifier hs-var">sty</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-185"></span><span>               </span><span class="annot"><span class="annottext">PprStyle -&gt; Module -&gt; OccName -&gt; SDoc
</span><a href="GHC.Types.Name.html#pprModulePrefix"><span class="hs-identifier hs-var">pprModulePrefix</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle
</span><a href="#local-6989586621681178470"><span class="hs-identifier hs-var">sty</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681178473"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681178472"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681178472"><span class="hs-identifier hs-var">occ</span></a></span><span>
</span><span id="line-186"></span><span>             </span><span class="annot"><span class="annottext">Maybe Module
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">WARN</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">True</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-identifier">Nothing</span><span>
</span><span id="line-187"></span><span>             </span><span class="hs-comment">-- Nothing is unexpected here; TyThings have External names</span><span>
</span><span id="line-188"></span><span>
</span><span id="line-189"></span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#pprTypeForUser"><span class="hs-identifier hs-type">pprTypeForUser</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-190"></span><span class="hs-comment">-- The type is tidied</span><span>
</span><span id="line-191"></span><span id="pprTypeForUser"><span class="annot"><span class="annottext">pprTypeForUser :: Type -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#pprTypeForUser"><span class="hs-identifier hs-var hs-var">pprTypeForUser</span></a></span></span><span> </span><span id="local-6989586621681178466"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681178466"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-192"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprSigmaType"><span class="hs-identifier hs-var">pprSigmaType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681178465"><span class="hs-identifier hs-var">tidy_ty</span></a></span><span>
</span><span id="line-193"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-194"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TidyEnv
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681178465"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681178465"><span class="hs-identifier hs-var">tidy_ty</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TidyEnv -&gt; Type -&gt; (TidyEnv, Type)
</span><a href="GHC.Core.TyCo.Tidy.html#tidyOpenType"><span class="hs-identifier hs-var">tidyOpenType</span></a></span><span> </span><span class="annot"><span class="annottext">TidyEnv
</span><a href="GHC.Types.Var.Env.html#emptyTidyEnv"><span class="hs-identifier hs-var">emptyTidyEnv</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681178466"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-195"></span><span>     </span><span class="hs-comment">-- Often the types/kinds we print in ghci are fully generalised</span><span>
</span><span id="line-196"></span><span>     </span><span class="hs-comment">-- and have no free variables, but it turns out that we sometimes</span><span>
</span><span id="line-197"></span><span>     </span><span class="hs-comment">-- print un-generalised kinds (eg when doing :k T), so it's</span><span>
</span><span id="line-198"></span><span>     </span><span class="hs-comment">-- better to use tidyOpenType here</span><span>
</span><span id="line-199"></span><span>
</span><span id="line-200"></span><span class="annot"><a href="GHC.Core.Ppr.TyThing.html#showWithLoc"><span class="hs-identifier hs-type">showWithLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-201"></span><span id="showWithLoc"><span class="annot"><span class="annottext">showWithLoc :: SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Core.Ppr.TyThing.html#showWithLoc"><span class="hs-identifier hs-var hs-var">showWithLoc</span></a></span></span><span> </span><span id="local-6989586621681178464"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681178464"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621681178463"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681178463"><span class="hs-identifier hs-var">doc</span></a></span></span><span>
</span><span id="line-202"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681178463"><span class="hs-identifier hs-var">doc</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\t'</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681178461"><span class="hs-identifier hs-var">comment</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681178464"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-203"></span><span>                </span><span class="hs-comment">-- The tab tries to make them line up a bit</span><span>
</span><span id="line-204"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-205"></span><span>    </span><span id="local-6989586621681178461"><span class="annot"><span class="annottext">comment :: SDoc
</span><a href="#local-6989586621681178461"><span class="hs-identifier hs-var hs-var">comment</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;--&quot;</span></span><span>
</span><span id="line-206"></span></pre></body></html>